SPB Git forge
38commits 1branches 0releases
338.7 MBsize
maindefault branch
6 h agolast push
HTML 53.9% TypeScript 44.5% JavaScript 0.6% SQL 0.5%
614 B · 15 lines tsx
Raw Blame History
1import { notFound } from "next/navigation";2import type { ReactNode } from "react";3import { api } from "@/lib/api";45/**6 * Existence check outside the loading boundary: a 404 from the API becomes a real HTTP 404 instead of a soft 4047 * streamed after a 200 shell. The fetch is deduplicated with the page's own call (same URL, same revalidate).8 */9export default async function SourceLayout({ params, children }: { params: Promise<{ id: string }>; children: ReactNode }) {10  const { id } = await params;11  const r = await api.source(id);12  if (!r.ok && r.status === 404) notFound();13  return <>{children}</>;14}15